﻿@model RPSImporter.Models.Settings.GeneralSettings
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div>
@using DevExpress.Web.Mvc.UI;
@{
   using (Html.BeginForm("ViewSettings", "Home", FormMethod.Post))
   {
      Html.DevExpress().PageControl(s =>
      {
          s.Width = System.Web.UI.WebControls.Unit.Percentage(100);
         s.Name = "settingsTabs";
         s.TabPages.Add("Paramètres Généraux").SetContent(() =>
         {
            this.ViewContext.Writer.Write(
               "<fieldset>" +
                  "<legend>" +
                     @RPSImporter.Properties.Resources.SettingsFileNames_Label +
                  "</legend>" +
                     @Html.HiddenFor(model => model.SettingsId) +
                   "<div class='editor-label'>" +
                       @Html.LabelFor(model => model.CompanyFileName) +
                   "</div>" +
                   "<div class='editor-field'>" +
                       @Html.TextBoxFor(model => model.CompanyFileName, new { style = "width:250px;" }) +
                       @Html.ValidationMessageFor(model => model.CompanyFileName) +
                   "</div>" +
                   "<div class='editor-label'>" +
                       @Html.LabelFor(model => model.EnterpriseFileName) +
                   "</div>" +
                   "<div class='editor-field'>" +
                       @Html.TextBoxFor(model => model.EnterpriseFileName, new { style = "width:250px;" }) +
                       @Html.ValidationMessageFor(model => model.EnterpriseFileName) +
                   "</div>" +
                   "<div class='editor-label'>" +
                       @Html.LabelFor(model => model.ExternalEnterprisesFileName) +
                   "</div>" +
                   "<div class='editor-field'>" +
                       @Html.TextBoxFor(model => model.ExternalEnterprisesFileName, new { style = "width:250px;" }) +
                       @Html.ValidationMessageFor(model => model.ExternalEnterprisesFileName) +
                   "</div>" +
                   "<div class='editor-label'>" +
                       @Html.LabelFor(model => model.HierarchyFileName) +
                   "</div>" +
                   "<div class='editor-field'>" +
                       @Html.TextBoxFor(model => model.HierarchyFileName, new { style = "width:250px;" }) +
                       @Html.ValidationMessageFor(model => model.HierarchyFileName) +
                   "</div>" +
                   "<div class='editor-label'>" +
                       @Html.LabelFor(model => model.PersonsFileName) +
                   "</div>" +
                   "<div class='editor-field'>" +
                       @Html.TextBoxFor(model => model.PersonsFileName, new { style = "width:250px;" }) +
                       @Html.ValidationMessageFor(model => model.PersonsFileName) +
                   "</div>" +
                   "<div class='editor-label'>" +
                       @Html.LabelFor(model => model.HoursPersonFileName) +
                   "</div>" +
                   "<div class='editor-field'>" +
                       @Html.TextBoxFor(model => model.HoursPersonFileName, new { style = "width:250px;" }) +
                       @Html.ValidationMessageFor(model => model.HoursPersonFileName) +
                   "</div>" +
                   "<div class='editor-label'>" +
                       @Html.LabelFor(model => model.HoursHierarchyFileName) +
                   "</div>" +
                   "<div class='editor-field'>" +
                       @Html.TextBoxFor(model => model.HoursHierarchyFileName, new { style = "width:250px;" }) +
                       @Html.ValidationMessageFor(model => model.HoursHierarchyFileName) +
                   "</div>" +
                   "<div class='editor-label'>" +
                       @Html.LabelFor(model => model.CsvDelimiter) +
                   "</div>" +
                   "<div class='editor-field'>" +
                       @Html.TextBoxFor(model => model.CsvDelimiter, new { style = "width:250px;" }) +
                       @Html.ValidationMessageFor(model => model.CsvDelimiter) +
                   "</div>" +
                   "<div class='editor-label'>" +
                        @Html.LabelFor(model => model.IsMultiColumnPersonImport) +
                   "</div>" +
                   "<div class='editor-field'>" +
                        @Html.CheckBoxFor(model => model.IsMultiColumnPersonImport) +
                   "</div>" +
               "</fieldset>");

         });
         s.TabPages.Add("Paramètres FTP").SetContent(() =>
         {
            this.ViewContext.Writer.Write(
               "<fieldset>" +
                     "<legend>" +
                        @RPSImporter.Properties.Resources.SettingsFtpConnection_Label +
                     "</legend>" +
                      "<div class='editor-label'>" +
                       @Html.LabelFor(model => model.FtpAddress) +
                      "</div>" +
                      "<div class='editor-field'>" +
                          @Html.TextBoxFor(model => model.FtpAddress, new { style = "width:250px;" }) +
                          @Html.ValidationMessageFor(model => model.FtpAddress) +
                      "</div>" +
                      "<div class='editor-label'>" +
                          @Html.LabelFor(model => model.FtpUsername) +
                      "</div>" +
                      "<div class='editor-field'>" +
                          @Html.TextBoxFor(model => model.FtpUsername, new { style = "width:250px;" }) +
                          @Html.ValidationMessageFor(model => model.FtpUsername) +
                      "</div>" +
                      "<div class='editor-label'>" +
                          @Html.LabelFor(model => model.FtpPassword) +
                      "</div>" +
                      "<div class='editor-field'>" +
                          @Html.TextBoxFor(model => model.FtpPassword, new { style = "width:250px;" }) +
                          @Html.ValidationMessageFor(model => model.FtpPassword) +
                      "</div>" +
                      "<div class='editor-label'>" +
                          @Html.LabelFor(model => model.FtpPassword) +
                      "</div>" +
                      "<div class='editor-field'>" +
                          @Html.TextBoxFor(model => model.FtpPassword, new { style = "width:250px;" }) +
                          @Html.ValidationMessageFor(model => model.FtpPassword) +
                      "</div>" +
                      "<div class='editor-label'>" +
                          @Html.LabelFor(model => model.FtpPath) +
                      "</div>" +
                      "<div class='editor-field'>" +
                          @Html.TextBoxFor(model => model.FtpPath, new { style = "width:250px;" }) +
                          @Html.ValidationMessageFor(model => model.FtpPath) +
                      "</div>" +
               "</fieldset>");
         });
         s.TabPages.Add("Paramètres Nom des Colonnes").SetContent(() =>
         {
            Html.DevExpress().PageControl(ss =>
            {
                ss.Width = System.Web.UI.WebControls.Unit.Percentage(100);
               ss.Name = "columnSettings";
               ss.TabPages.Add("Personnel").SetContent(() =>
               {
                  Html.RenderPartial("PartPersonFileSettings",
                     RPSImporter.Services.DatabaseSvc.Instance.Settings.PersonFileSettings.FirstOrDefault());
               });
               ss.TabPages.Add("Siège Social").SetContent(() =>
               {
                  Html.RenderPartial("PartCompanyFileSettings",
                     RPSImporter.Services.DatabaseSvc.Instance.Settings.CompanyFileSettings.FirstOrDefault());
               });
               ss.TabPages.Add("Etablissement").SetContent(() =>
               {
                  Html.RenderPartial("PartEnterpriseFileSettings",
                     RPSImporter.Services.DatabaseSvc.Instance.Settings.EnterpriseFileSettings.FirstOrDefault());
               });
               ss.TabPages.Add("Organisation Fonctionnelle").SetContent(() =>
               {
                  Html.RenderPartial("PartHierarchyFileSettings",
                     RPSImporter.Services.DatabaseSvc.Instance.Settings.HierarchyFileSettings.FirstOrDefault());
               });
               ss.TabPages.Add("Heures Travaillées par Service").SetContent(() =>
               {
                  Html.RenderPartial("PartHierarchyHoursFileSettings",
                     RPSImporter.Services.DatabaseSvc.Instance.Settings.HoursHierarchyFileSettings.FirstOrDefault());
               });
               ss.TabPages.Add("Heures Travaillées par Personne").SetContent(() =>
               {
                  Html.RenderPartial("PartHierarchyPersonFileSettings",
                     RPSImporter.Services.DatabaseSvc.Instance.Settings.HoursPersonFileSettings.FirstOrDefault());
               });
            }).Render();
         });
      }).Render();
      <p>
         <input type="submit" value="Enregistrer" />
      </p>
   }
}
</div>